let global = 'null';
let isTime = "" //time标识存放容器
export default {
	/* 加密 */
	secretPass(num) {
		var str = num
		var reg = /^(\d{3})\d+(\d{4})$/;
		str = str.replace(reg, "$1 **** $2");
		return str
	},
	toal(num1, num2) {
		console.log(global, 'global');
		return num1 + num2
	},
	/* 发抖 */
	AjaxShake(fn, time) {
		clearTimeout(isTime)
		return isTime = setTimeout(async () => {
			await fn()
			console.log('定时对象', isTime)
		}, time)
	},
	/* 动态标题 */
	setTitle(title) {
		console.log(title, 'titletitle');
		uni.setNavigationBarTitle({
			title: title
		});
	},
	transformTimestamp(timestamp) {
		let time = timestamp; //create_time是从后端传过来的2023-03-08T08:46:15.000+00:00
		let date = new Date(time);
		let times = date.getFullYear() + '-' + ((date.getMonth() + 1) < 10 ? "0" + (date.getMonth() + 1) :
			(date
				.getMonth() + 1)) + '-' + (date.getDate() < 10 ? "0" + date.getDate() : date
			.getDate()) + ' ' + (
			date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ':' + (date
			.getMinutes() < 10 ?
			"0" + date.getMinutes() : date.getMinutes()) + ':' + (date.getSeconds() < 10 ? "0" + date
			.getSeconds() : date.getSeconds());
		// this.commentList[i].create_time = times //现在的times是2023-03-08 16:46:15这种格式
		console.log(times);
		return times
	},



}